package breeze.update.album;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListAdapter;
import android.widget.ListView;
import breeze.update.album.R;
import java.io.File;
import java.util.List;
import android.widget.Toast;
import java.util.ArrayList;

public class HiddenAlbumActivity extends Activity {
    /*
	*@author BREEZE
	*@date 2021-10-02 07:38:53
    */
	private ListView listview;
	private FileUtils utils;
	private List<String> datas;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_hidden);
		utils = new FileUtils(this);
		listview = findViewById(R.id.activityhiddenListView1);
		datas = utils.getDatas();
		final ArrayAdapter adapter = new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1,datas);
		listview.setAdapter(adapter);
		listview.setOnItemLongClickListener(new OnItemLongClickListener(){

				@Override
				public boolean onItemLongClick(AdapterView<?> p1, View p2, int p3, long p4) {
					String path = datas.get(p3);
					File file = new File(path);
					if(file.exists()){
						file.delete();
					}
					utils.delete(path);
					datas.remove(path);
					adapter.notifyDataSetChanged();
					Toast.makeText(HiddenAlbumActivity.this,"恢复成功",Toast.LENGTH_SHORT).show();
					return false;
				}
				
		});
    }
    
}
